package Control;

import GameControl.GameControl;
import java.io.Serializable;

/**
 * <code>Message</code> class instances represent chat messages.
 * @author Dimon
 */
public class Message extends Command implements Serializable {

    /**
     * Incapsulated message.
     */
    private String message;

    /**
     * Constructs a message.
     * @param message message to be incapsulated
     */
    public Message(String message) {
        this.message = message;
        Debug("created " + toString());
    }

    /**
     * Shows the message.
     */
    @Override
    public void perform() {
        GameControl.ChatMessage(ID + ": " + message);
    }

    /**
     * Describes message.
     * @return message description
     */
    @Override
    public String toString() {
        return "message '" + message + "'" + super.toString();
    }
}
